<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Order.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/biaoge.css"/>
	<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.4.css"/>
    <script type="text/javascript" src="jquery/js/jquery-1.8.2.js"></script> 
      <script type="text/javascript" src="fancybox/jquery.easing-1.3.pack.js"></script> 
	<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.js"></script> 
	<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script> 
	<script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.4.pack.js"></script> 
     <script type="text/javascript" src="js/JTimer_2.0.js"></script>
    
  </head>
  <script type="text/javascript">
  
   function fangda(tupian){
   $("#"+tupian+"k").fancybox();
  }
  
   function getone(a){
     window.location="orderdetail.action?orderid="+a;
   }
   
 
  
   function sele(){
  var da=$("#riqi").val();
   var indusname=$("#gongchang").val();
   //alert("selectBydate.action?datetime='"+da+"'&&indusid="+indusid);
   window.location="selectBydate.action?datetime="+da+"&&indusname="+indusname;
  }
   $(document).ready(function(){
   setInterval(
      ajaxfanstate
,5000);
   }
   );
   
  function ajaxfanstate(){
   var tm=$("#datetime").val();
   var indus=$("#indusname").val();
    $.post("selectorderbydate.action",
				{datetime:tm,indusname:indus},  
      		function(data){
      		//alert("asdfasdfasd");
      		 var len=data.jsonob.length;
      		 //$("#"+id+"").html("已发货");
      		 //var k='<font color="blue">已发货</font>';
      		 for(var i=0;i<len;i++)
      		 {
      		 if(data.jsonob[i].costFeedback!=null&&data.jsonob[i].costFeedback!=""){
      		 //alert("asda");
      		 document.getElementById(data.jsonob[i].orderId).innerHTML="工厂有反馈";
      		 }
      		 }
      		},
      		 "json"
      		);  
      		//alert("aaaaa");
  }
  </script>
  <body>
            <div style="margin-left:100px">   
<div style="float:right;margin-top:-70px">订单查询：<br>选择时间：<input type="text" name="riqi" id="riqi" onclick="JTC.setday({format:'yyyy-MM-dd', readOnly: true})"><br>
      工厂名称：<input type="text" name="gongchang" id="gongchang"><input type="button"  value="查询" onclick="sele()">
        </div>  
        
         <div style="width:1000px;margin-left: 150px;margin-top:70px" id="order">
                 <font size="3" color="red">${datetime}${indusname}的订单如下：如果没有制作CDR文件，可以点击订单详细信息查看图片制作然后上传图片即可。</font>           
  <table id="mytable" cellspacing="6">
  <tr >
  <td>订单图片</td><td>订单名字</td><td>下单用户</td><td>下单时间</td><td>订单详细信息</td><td>订单对应工厂</td><td>订单状态</td><td>是否制作CDR文件</td></tr>
   <c:forEach items="${orderlist}" var="order"> 
   <c:if test="${!empty order.orderName}">
  <tr>
     <td><img src="${order.orderPic}" style="height:76px;width:100px"/>
   <a id="${order.orderId}k" href="${order.orderPic}"><img src="img/fangda.gif" onclick="fangda('${order.orderId}')" style="float: right;"></a></td> <td>${order.orderName}</td><td>${order.userName}</td><td><fmt:formatDate value="${order.orderTime}" pattern="yyyy-MM-dd HH:mm:ss" /></td> 
   <td><input type="button" value="查看详细信息" onclick="getone('${order.orderId}')"></td>  
   <td>${order.industryName}</td> 
   <c:choose>
   <c:when test="${order.orderState==0}">
   <td id="${order.orderId}"><font size="3" color="black">用户未付款</font></td>
   </c:when>
   
   <c:when test="${order.orderState==1}">
   <td id="${order.orderId}"><font size="3" color="red">用户已付款，未发货</font>
    <c:if test="${! empty order.costFeedback}">
    <font size="3" color="red">工厂有反馈</font>
   </c:if>
   </td>
   </c:when>
   
    <c:when test="${order.orderState==2}">
   <td id="${order.orderId}"><font size="3" color="blue">已发货</font>
     <c:if test="${! empty order.costFeedback}">
     <font size="3" color="blue">工厂有反馈</font>
     </c:if>
   </td>
   </c:when>
   
    <c:when test="${order.orderState==3}">
   <td id="${order.orderId}"><font size="3" color="grey">成功交易</font></td>
   </c:when>
   
   </c:choose>
  
  <c:if test="${empty order.CDRurl}">
   <td><font size="3" color="red">未制作</font></td>
   </c:if>
   <c:if test="${!empty order.CDRurl}">
   <td>已制作</td>
   </c:if>
    <tr>
    </c:if>
   </c:forEach>
                      
  </table>
  <img src="<%=request.getContextPath()%>/img/resources/webbeiUserInfo/xiaoming/userCustom/全罩车衣630480.png" style="width: 100px">
  <br>
  
 </div>
  </div>           
					
  </body>
</html>
